<template>
  <div class="dialog-form">
    <el-form :model="form" label-width="96px">
      <el-row :gutter="36">
        <el-col :span="12">
          <el-form-item label="公司名称：" prop="name">{{ form.name }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="公司负责人：" prop="head">{{ form.head }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="主营业务：" prop="mainBusiness">{{ form.mainBusiness }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款帐号：" prop="receivingAccount">{{ form.receivingAccount }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="所在城市：" prop="cityValue">
            <dict-tag :options="company_city_area" :value="form.cityValue" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="公司地址：" prop="address">{{ form.address }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="联系电话：" prop="phone">{{ form.phone }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="联系邮箱：" prop="email">{{ form.email }}</el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="公司状态：" prop="state">
            <dict-tag :options="sys_company_status" :value="form.state" />
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="公司简介：" prop="profile">{{ form.profile }}</el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="dialog-footer">
      <el-button type="primary" @click="onCancel">关闭</el-button>
    </div>
  </div>
</template>

<script setup>
import { getCompany } from "@/api/company/company"
const { proxy } = getCurrentInstance()
const { sys_company_status, company_city_area } = proxy.useDict("sys_company_status", 'company_city_area')

const emits = defineEmits(['cancel'])

const form = ref({})

const pageInit = (id) => {
  getCompany(id).then(response => {
    form.value = response.data
    form.value.id = id
    form.value.state = form.value.state.toString()
  })
}

const onCancel = () => {
  emits('cancel')
}

defineExpose({
  pageInit
})

</script>

<style lang="scss" scoped>

</style>